/**
 * 
 */
package com.bestbuy.daoimple;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.bestbuy.dao.ProductDao;
import com.bestbuy.pojo.Account;
import com.bestbuy.pojo.Product;

/**
 * @author Tuan
 *
 */
@Repository
@SuppressWarnings({"unchecked", "rawtypes"})
public class ProductDAOImpl implements ProductDao{

	@Autowired
	private SessionFactory sessionFactory;
	
	/* (non-Javadoc)
	 * @see com.bestbuy.dao.ProductDao#getListProduct()
	 */
	public List<Product> getListProduct() {
		Session session = sessionFactory.getCurrentSession();
		
		String sql = "from Product";
		Query query = session.createQuery(sql);
		
		List<Product> sp = (List<Product>) query.list();
		return sp;
	}

	/* (non-Javadoc)
	 * @see com.bestbuy.dao.ProductDao#getProduct()
	 */
	public Product getProduct() {
		// TODO Auto-generated method stub
		return null;
	}

}
